package com.jvxb.demo.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jvxb.demo.controller.base.BaseCURDController;
import com.jvxb.demo.entity.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jvxb.demo.service.SysUserService;
import com.jvxb.demo.utils.ResponseDataVo;

import java.util.List;

/**
 * <p>
 * 系统用户表 前端控制器
 * </p>
 *
 * @author jvxb
 * @since 2022-12-11
 */
@Api(tags = "系统用户")
@RestController
@RequestMapping("/demo/sysUser")
public class SysUserController extends BaseCURDController<SysUser> {

    @Autowired
    private SysUserService sysUserService;

    @ApiOperation("查找id")
    @GetMapping("/getList")
    public ResponseDataVo<List<SysUser>> getList(String keyword) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.like(StrUtil.isNotBlank(keyword), SysUser.USER_NAME, keyword);
        List<SysUser> list = sysUserService.list(wrapper);
        return ResponseDataVo.success(list);
    }

}
